import java.util.concurrent.CountDownLatch;

/**
 * Description： TODO
 * Author： 王多鱼
 * CreateTime： 2021/6/10 20:53
 **/
public class CountDownLatchDemo {
    public static void main(String[] args) throws Exception {
        CountDownLatch countDownLatch = new CountDownLatch(6);
        for (int i = 1; i <=6 ; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"\t 上完自习，离开教室");
                countDownLatch.countDown();
            },String.valueOf(i)).start();
        }
        countDownLatch.await();
        System.out.println(Thread.currentThread().getName()+"\t -----班长最后关门走人------");
    }
}

